﻿using Newtonsoft.Json;
using System;

namespace PenguinPublishNS.Models
{
    public class HostServer //: INotifyPropertyChanged
    {
        // it seems that implementing INotifyPropertyChanged is not necessary when you have ObservableCollection working
        // with WPF binding 

        //private string host;
        //public string hostName
        //{
        //    get { return host; }
        //    set { host = value; OnPropertyChanged(this, "hostName"); }
        //}

        //private string hostAddress;
        //public string HostAddress
        //{
        //    get { return hostAddress; }
        //    set { hostAddress = value; OnPropertyChanged(this, "HostAddress"); }
        //}

        // using JSON.NET schema generator, need to use attributes: [JsonProperty(Required = Required.AllowNull)]

        [JsonProperty(Required = Required.AllowNull)]
        public string hostName { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public string HostAddress { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public string privateKey { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public string keyPassphrase { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public string username { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public string password { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public string sitePath { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public string destinationURL { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public DateTime lastPublished { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public DateTime lastValidated { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public DateTime lastModified { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public Guid hostId { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public bool usePPK { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public bool sftpValid { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public string snapshotHash { get; set; }
        [JsonProperty(Required = Required.AllowNull)]
        public bool ipAvailable { get; set; }

        //public event PropertyChangedEventHandler PropertyChanged;

        //// Create the OnPropertyChanged method to raise the event 
        //protected void OnPropertyChanged(object sender, string propertyName)
        //{
        //    //PropertyChangedEventHandler handler = PropertyChanged;
        //    if (this.PropertyChanged != null)
        //    {
        //        PropertyChanged(sender, new PropertyChangedEventArgs(propertyName));
        //    }
        //}
    }

}
